package com.wmm.fast.main.shop2Observer.eventBus;

import lombok.Data;
import lombok.extern.slf4j.Slf4j;

/**
 * @Auther: wangzun
 * @Date: 2018/9/13 11:18
 * @Description: 默认实现事件通知者
 */
@Data
@Slf4j
public  class DefaultNotifier extends Notifyler {

    @Override
    public void addListener(Object bean, String methodName, Object... args) {
      log.info("添加新的委托事件");
        EventHandler handler = this.getEventHandler();
        handler.addEvent(bean, methodName, args);
    }

    @Override
    public void notifyEAll() {
        log.info("委托执行通知");
        try {
            this.getEventHandler().notifyE();
        } catch (Exception e) {
            log.info("通知异常");
        }
    }
}
